
<template>
  <div id="cesiumContainer"></div>
  <router-view />
</template>

<script setup>
import * as Cesium from 'cesium'
import CesiumZh from './tool/cesiumToZh'
import { onMounted,getCurrentInstance } from 'vue';
// import { app } from './main';
// import {load3dtiles,update3dtiles} from './tool/load3D.js'
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI5YmMwMWQzMS1iZjg4LTRlZDItYTNmZC01MWEyMzk4NmYwNzEiLCJpZCI6MjQwNjA4LCJpYXQiOjE3MjYwMjAyNzR9.oHC1L475KukrHI4ppPwqjJB0rQUbV4cr4le-6m6ceHQ'
let viewer
const {appContext} = getCurrentInstance()
const global = appContext.config.globalProperties
  onMounted(() => {
  viewer = new Cesium.Viewer('cesiumContainer', {
    baseLayerPicker: false, //是否显示图层选择控件
    animation: false, //是否显示动画控件
    timeline: false, //是否显示时间轴控件
    fullscreenButton: false, //是否显示全屏按钮
    geocoder: false, //是否显示搜索按钮
    homeButton: false, //是否显示主页按钮
    navigationHelpButton: false, //是否显示帮助提示按钮
    sceneModePicker: false, //是否显示投影方式按钮
    shouldAnimate: true,
    infoBox: false,
    selectionIndicator: false
  })

  CesiumZh.load()
  const tileset = viewer.scene.primitives.add(
    new Cesium.Cesium3DTileset({
      url: Cesium.IonResource.fromAssetId(69380)
    })
  )
  viewer.zoomTo(tileset)
  global.$viewer = viewer
  global.$tileset = tileset
  // app.config.globalProperties.$viewer = viewer
})

</script>
<style lang="scss">
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
#cesiumContainer{
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
.cesium-viewer-bottom {
  display: none;
}
</style>
